package org.eclipse.ea.requisit.manager.utils;

public class StringUtils {

	/**
	 * 
	 * @param s
	 * @return
	 */
	public static boolean isValid(String s) {

		if (s != null) {

			String value = s.trim();

			if (!value.equals("")) {
				return true;
			}

		}

		return false;

	}

	/**
	 * 
	 * @param value
	 * @return
	 */
	public static String replaceBar(String value) {

		return value.replace("/", "\\");

	}

	/**
	 * 
	 * @param value
	 * @return
	 */
	public static String emptyOrValue(String value) {

		if (value == null) {
			return " ";
		}

		return value;
	}
	
	public static String numericOrZero(String value){
		
		String format = value;
		
		try{
			format = format.trim();
			Double.parseDouble(format);
		}catch(Exception e){
			format = "0";
		}
		
		return format;
		
	}
}
